package handler;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import org.apache.commons.dbutils.ResultSetHandler;

import drh.bean.OrderDetail;

public class OrderDetailResultSetHandler implements ResultSetHandler<List<OrderDetail>> {

	@Override
	public List<OrderDetail> handle(ResultSet rs) throws SQLException {
		List<OrderDetail>list = new ArrayList<>();
		while(rs.next()) {
			OrderDetail info = new OrderDetail();
			info.setId(rs.getInt("id"));
			info.setOrderid(rs.getInt("orderid"));
			info.setAmount(rs.getInt("amount"));
			info.setMoney(rs.getInt("money"));
			info.setProductid(rs.getInt("productid"));
			info.setTime(rs.getDate("time"));
			info.setIsdelete(rs.getInt("isdelete"));
			info.setUserid(rs.getInt("userid"));
			list.add(info);
		}
		return list;
	}

	

}
